package com.denlaku.longan.lock;

import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.ReentrantLock;

/**
 *
 * @author tianx
 */
class LocalLock implements Lock {
    private final ReentrantLock lock;

    public LocalLock(ReentrantLock lock) {
        this.lock = lock;
    }

    @Override
    public boolean tryLock() {
        return lock.tryLock();
    }

    @Override
    public boolean tryLock(long timeout, TimeUnit unit) throws Exception {
        return lock.tryLock(timeout, unit);
    }

    @Override
    public boolean isLocked() {
        return lock.isLocked();
    }

    @Override
    public void lock() {
        lock.lock();
    }

    @Override
    public void unlock() {
        lock.unlock();
    }

    @Override
    public void forceUnlock() {
        this.unlock();
    }
}
